#include <stdio.h>
#define	ABS(n)	val >= 0 ? val : 0 - val
#define NEG(n)	n = 0 - n
int abs(int val) {
	if(val >= 0) {
		return val;
	}
	else {
		return 0 - val;
	}
}
void neg(int *p_val) {
	*p_val = 0 - *p_val;
}
int main() {
	int val = 0;
	printf("请输入一个数字：");
	scanf("%d",&val);
	printf("用宏求得绝对值是%d\n",ABS(val));
	printf("用函数求得绝对值是%d\n",abs(val));
	NEG(val);
	printf("val用宏求得相反数是%d\n",val);
	neg(&val);
	printf("val用函数求得相反数是%d\n",val);
	return 0;
}
